Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

progress-stream

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

progress-stream

Read the progress of a stream

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
398K
decreased by-36.61%
Maintainers
1
Weekly downloads
 
Created

What is progress-stream?

The `progress-stream` npm package is used to monitor the progress of data being streamed. It is particularly useful for tracking the progress of file uploads, downloads, or any other data transfer operations. The package provides a simple interface to get updates on the amount of data transferred, the speed of transfer, and the estimated time remaining.

What are progress-stream's main functionalities?

Basic Progress Tracking

This feature allows you to track the progress of a file being read and written. The `progress` event provides updates on the percentage completed, the speed of transfer, and the estimated time remaining.

const progress = require('progress-stream');
const fs = require('fs');

const stat = fs.statSync('file.txt');
const str = progress({ length: stat.size, time: 100 });

str.on('progress', function(progress) {
  console.log(progress);
});

fs.createReadStream('file.txt').pipe(str).pipe(fs.createWriteStream('copy.txt'));

Custom Progress Handling

This feature allows for custom handling of progress updates. You can log specific details such as the number of bytes transferred, the speed of transfer, and the estimated time remaining.

const progress = require('progress-stream');
const fs = require('fs');

const stat = fs.statSync('file.txt');
const str = progress({ length: stat.size, time: 100 });

str.on('progress', function(progress) {
  console.log(`Transferred: ${progress.transferred} bytes`);
  console.log(`Speed: ${progress.speed} bytes/sec`);
  console.log(`ETA: ${progress.eta} seconds`);
});

fs.createReadStream('file.txt').pipe(str).pipe(fs.createWriteStream('copy.txt'));

Other packages similar to progress-stream

Keywords

FAQs

Package last updated on 11 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc